# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=plocate
pkgver=1.1.20
pkgrel=0
pkgdesc="posting-list based locate(1) for finding files"
url="https://plocate.sesse.net/"
arch="all"
license="GPL-2.0-or-later"
pkggroups="locate"
depends="!mlocate"
install="$pkgname.pre-install"
makedepends="
	liburing-dev
	linux-headers
	meson
	musl-legacy-error
	zstd-dev
	"
subpackages="$pkgname-doc"
source="https://plocate.sesse.net/download/plocate-$pkgver.tar.gz
	plocate.cron
	updatedb.conf
	"
# no tests
# plocate is g+s
options="suid !check"

build() {
	abuild-meson \
		-Dlocategroup=locate \
		-Dinstall_cron=false \
		-Dinstall_systemd=false \
		. output
	meson compile -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
	install -Dm755 "$srcdir"/plocate.cron \
		"$pkgdir"/etc/periodic/daily/plocate
	install -Dm644 "$srcdir"/updatedb.conf \
		-t "$pkgdir"/etc
	chmod -R g+w "$pkgdir"/var/lib/plocate
	chgrp -R locate "$pkgdir"/var/lib/plocate
}

sha512sums="
511a25f7e1dba3e9ea836dc3b462cf3b1aa3c111819531fad73857bc0fd22fcbc387715a8981ef58be31103b6ac802468eb18b32826dc220a6781ebf83b1c153  plocate-1.1.20.tar.gz
4f3f1ef1016abe0488fe0b61eec03fa6ce340d4abe59b4d371d0085934244cffe3af67669505ded2427f03a026857806de0479050d4e023817cae58390a7cb88  plocate.cron
863d8687bc1c520cc262ade3a7ce8a02b6930d7cbbc588c36d23f81a4a4c5432f4d9234a5498632b767a352e3996cf4da1c9e98d1b699b9d973cd9a9313d9557  updatedb.conf
"
